<?
$protectid="201"; 
include ("../protect.php");
include "../../class/page.php";
require("../../class/mysqldb.inc.php");
$db=new mysqldb();
$page = new ShowPage;
$page->PageSize = 100;

if($action == 'auto'){
	$sql = "update  hy_member  set auto = $autype where user_id = $uid ";
    $msg = $db->query($sql);
	if($msg) echo "<script>alert('操作成功');</script>";
		else echo "<script>alert('操作失败！');</script>";
}

if($keywords!=""){$sqlwhere .=" and user_name like '%$keywords%' ";}
if($s_city)  {$sqlwhere .=" and s_city = '$s_city' ";}
if($s_county)  {$sqlwhere .=" and s_county = '$s_county' ";}
if($s_qu)  {$sqlwhere .=" and s_qu = '$s_qu' ";}
//$totalnumsql = "select * from hy_member where user_shen=1 or user_shen=2 order by user_id

$totalnumsql = "select * from hy_member where 1  ".$sqlwhere." order by user_id";
$db->query($totalnumsql);
$recordcount = $db->get_num1();
$page->Total = $recordcount;
//$sql = "select * from hy_member where user_shen=1 or user_shen=2 order by user_id desc limit ".$page->OffSet();
$sql = $totalnumsql." limit ".$page->OffSet();
$db->query($sql);
$news_result=$db->get_data();
$news_num=$db->get_num1();
?>
<html>
<head>
<title>会员管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../css/css.css" type="text/css">
<script language="javascript">
var imgPlus		= new Image();
var imgMinus	= new Image();
imgPlus.src		= '../images/xiang.gif';
imgMinus.src	= '../images/xiang1.gif';
			
function warn1()
{
if(confirm("请注意，一旦删除，将不可恢复"))
   {
     document.fm2.submit()
    }
}

 function turn(page){
   window.location.href="index.php?pagenum="+page
 }

 function selectall(){
   for(i=0;i<document.fm2.elements.length-2;i++)
   {
      // alert(document.fm2.elements.length)
       document.fm2.elements[i].click()

	}
	    document.fm2.Button.value=((document.fm2.Button.value=="全部选中")?"取消全选":"全部选中")
 }
 
function war(str)
{
  if(confirm("确认删除吗"))
    {
	  window.navigate("del_pro.php?id="+str)
	 }
}

function Detail(imgObj,divObj)
			{
				if(divObj.style.display == 'block')
				{
					divObj.style.display = 'none';
					imgObj.src = imgPlus.src;
				}
				else
				{
					divObj.style.display = 'block';
					imgObj.src = imgMinus.src;
				}
      }
			
</script>
<script type="text/javascript" src="../../js/jquery-1.8.0.min.js"></script>
<style type="text/css">
<!--
.style1 {
	color: #666666;
	font-weight: bold;
}
body {
	background-color: #F7F7F7;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
</head>
<body text="#000000">
<br>
  <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" class="word">
 
    <tr valign="top">
      <td colspan="2" height="2">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="100%" height="41" valign="top">
              <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" class="word">
				 <tr>
                  <td height="30" colspan="13" valign="top"> <div align="center">
                    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bgtitle">
                      <tr>
                        <td height="30" colspan="2" background="../images/center1t.jpg"><table width="33%" height="24"  border="0" align="right" cellpadding="0" cellspacing="0">
                          <form name="form1" method="post" action="">
                            <tr>
                            
                              <td width="53%" height="24" nowrap><span class="style1">会员名称:</span>&nbsp;&nbsp;
                                  <input name="keywords" type="text"  size="20"></td>
                                  
                                    <td width="53%" height="24" nowrap><span class="style1">市 区（县） 镇 :</span>&nbsp;&nbsp;
                                  <select name="s_city" id="s_city">
       <option value=''>
	       请选择
	      </option>
	    <?php	
		$SQL=" select * from hy_b_city where ParentID =116  ";
		$db->query($SQL);
		$result = $db->get_data();
		if($result){
		foreach($result as $key=>$value){
	 ?>
	    <option value="<?=$value['CityID']?>">
	      <?=$value['CateName']?>
	      </option>
	    <? }}?>
      </select>
      
	   <select name="s_county" id="s_county">
	    <option value=''>
	       请选择
	      </option>
      </select>
          
           <select name="s_qu" id="s_qu">
	    <option value=''>
	       请选择
	      </option>
      </select>     
                   
                   
                    <script>
          
$('#s_city').change( function () { 
		$.ajax({
		   type: "get",
		   url: "../../selectcity.php",
		   data: "pid="+this.value,
		   success: function(msg){
			  // alert(msg);
			    $('#s_county').html(msg);
		   }
		});
});


$('#s_county').change( function () { 
		$.ajax({
		   type: "get",
		   url: "../../selectcity.php",
		   data: "pid="+this.value,
		   success: function(msg){
			    $('#s_qu').html(msg);
//			 alert( "Data Saved: " + msg );
		   }
		});
});



          </script>              </td>
                                  
                                  
                              <td width="13%"><input type="submit" name="Submit2" value="搜索"></td>
                            </tr>
                          </form>
                        </table>
                        <table width="332" height="18" border="0" align="left" cellpadding="0" cellspacing="0">
                          <tr>
                            <td width="151"><div align="center"><strong> <img src="../images/pro.jpg" width="24" height="24">会 员 管 理</strong></div></td>
                            <td width="181">&nbsp;</td>
                          </tr>
                        </table></td>
                      </tr>
                    </table>
                    </div></td>
                </tr>
				 <form name="fm2"  method="post" action="del_member.php" >
				<tr >
                  <td width="2%" height="30" background="../images/title3.gif" align="center"><span class="style1">详细</span></td>
                  <td width="6%" background="../images/title3.gif" align="center"><span class="style1">ID</span></td>
                  <td width="6%" background="../images/title3.gif" align="center"><span class="style1">用户名</span></td>
                  <td width="7%" align="center" background="../images/title3.gif"><b>网店负责人</b></td>
               
                   <td width="8%" align="center" background="../images/title3.gif"><span class="style1">审核状态</span></td>
                  
                  <td width="7%" align="center" background="../images/title3.gif"><span class="style1">会员积分</span></td>
                  
                  
                  <td width="5%" align="center" background="../images/title3.gif"><span class="style1">余额</span></td>
                  
                   <td width="5%" align="center" background="../images/title3.gif"><span class="style1">市</span></td>
                   
                   <td width="5%" align="center" background="../images/title3.gif"><span class="style1">区（县）</span></td>
                   
                   
                   <td width="5%" align="center" background="../images/title3.gif"><span class="style1">镇</span></td>
                   
                  <td width="13%" align="center" background="../images/title3.gif"><span class="style1">充值纪录</span></td>
                <td width="29%" align="center" background="../images/title3.gif"><span class="style1">审核操作</span></td>
                  <td width="3%" align="center" background="../images/title3.gif"><span class="style1">删除</span></td>
                </tr>
                <?
				$j=0;
				 if ($news_num>0){
				  for ($i=0;$i<$news_num;$i++){
              ?>
                <?
			  //色彩渐变
			  if($j==0)
			  {
			    echo "<tr>";
				$j=1;
			   }else
			   {
			     $j=0;
			  ?>
                <tr bgcolor="#f5f5f5">
                  <?
			   }
			   ?>
                  <td height="28" align="center"><img src="../images/xiang.gif" width="9" height="9" onClick='Detail(this, <? echo 'subDiv_'.$news_result[$i]['user_id']?>);' style='cursor:hand'></td>
                   <td height="28" align="center"><? echo $news_result[$i]['user_id'];?>&nbsp;</td>
                  <td height="28" align="center"><? echo $news_result[$i]['user_name'];?>&nbsp;</td>
                  <td width="7%" align="center"><? echo $news_result[$i]['user_truename'];?>&nbsp;</td>
                  <!--  <td width="11%" align="center"> <? echo ($news_result[$i]['user_sex']=="1"?"男":"女");?>&nbsp;                  </td>-->
                  
                    
				    <td width="8%" align="center"> 
                 <? if($news_result[$i]['auto'] == 1 || $news_result[$i]['auto'] == 2 ){?>
                  <? echo $news_result[$i]['auto'] == 1 ? '审核通过':'审核不通过'; ?>   <? }else{?>
                      未审核
                 <? 
				 
				 }?>
                 </td>
                  <td  align="center"><? echo $zhifenarr[] = $news_result[$i]['zhifen'];?></td>
               
               <td  align="center">&nbsp;<? echo $moneyarr[] = $news_result[$i]['money'];?></td>
               
               <td align="center">&nbsp;
                 <? 
	 	$SQLs=" select CateName from hy_b_city where CityID = '".$news_result[$i]['s_city']."'";
		$db->query($SQLs);
		$results = $db->get_data();
		echo $results[0]['CateName'];
					   ?>&nbsp;</td><td>
                 <? 
	 	$SQLs=" select CateName from hy_b_city where CityID = '".$news_result[$i]['s_county']."'";
	    $db->query($SQLs);
		$results = $db->get_data();
		echo $results[0]['CateName'];
					   ?>&nbsp;</td><td>&nbsp;
                         <? 
	 	$SQLs=" select CateName from hy_b_city where CityID = '".$news_result[$i]['s_qu']."'";
	    $db->query($SQLs);
		$results = $db->get_data();
		echo $results[0]['CateName'];
					   ?>
                       
                       </td>
               
			     <td width="13%" align="center"><a href="czhistory.php?id=<?=$news_result[$i]['user_id']?>">充值纪录</a></td>
                 <td width="29%" align="center"> 
                  <? if(!$news_result[$i]['auto']){?>
                 <a href="?action=auto&uid=<? echo $news_result[$i]['user_id'];?>&autype=1">审核通过</a>&nbsp;
                 <a href="?action=auto&uid=<? echo $news_result[$i]['user_id'];?>&autype=2">审核不通过</a>
                 
                 <? }else echo "已处理";?>
                 </td>
                 
                  <td width="3%" align="center"><input type="checkbox" name="choice[]" value="<? echo $news_result[$i]['user_id'];?>"></td>
                </tr>
                <tr id='<? echo 'subDiv_'.$news_result[$i]['user_id'];?>' style="display:none">
                  <td height="30" colspan="10"  bgcolor="#F5F5F5">
				  <table width="100%"  border="1" cellpadding="0" cellspacing="0" bordercolor="#999999" bordercolorlight="#999999" bordercolordark="#FFFFFF" bgcolor="#FFF7EE">
          					
                    <tr>
                      <td height="28" align="center">县份、区域:</td>
                      <td>&nbsp;
                       </td>
                    </tr>
                 
                    
                    
                    <tr>
                      <td height="28" align="center">注册时间:</td>
                      <td><? echo $news_result[$i]['user_regtime'];?>&nbsp;</td>
                    </tr>
                    <tr>
                      <td width="14%" height="28" align="center">联系QQ号：</td>
                      <td width="86%"><? echo $news_result[$i]['user_qq'];?></td>
                    </tr>
                   <tr>
                      <td height="29" align="center">网店名称：</td>
                      <td>&nbsp;<? echo $news_result[$i]['user_shopname']; ?></td>
                    </tr>
                    <tr>
                      <td height="28" align="center">Email：</td>
                      <td><? echo $news_result[$i]['user_email'];?>&nbsp;</td>
                    </tr>
                  <!--  <tr>
                      <td height="28" align="center">工作单位：</td>
                      <td><? echo $news_result[$i]['user_company'];?>&nbsp;</td>
                    </tr>-->
					 <tr>
                      <td height="28" align="center">网店属性：</td>
                      <td><? echo $news_result[$i]['shopattr'];?>&nbsp;</td>
                    </tr>
					 <tr>
                      <td height="28" align="center">电话：</td>
                      <td><? echo $news_result[$i]['user_mobile'];?>&nbsp;</td>
                    </tr>
                    
                     <tr>
                      <td height="28" align="center">QQ：</td>
                      <td><? echo $news_result[$i]['user_qq'];?>&nbsp;</td>
                    </tr>
					 
					
                    <tr>
                      <td height="28" align="center">常用银行账号：</td>
                      <td><? echo $news_result[$i]['user_intro'];?><? echo $news_result[$i]['desc'];?>&nbsp;</td>
                    </tr>
                  </table>
				  </td>
                </tr>
				  <?
			           }
					}
			   ?>
                <tr class="bgtitle">
                  <td height="30" colspan="14"  background="../images/title3.gif" > <div align="center">
                       <input type="button" name="Buttonfff" value="删除所选" onClick="warn1()"> &nbsp;&nbsp;
                      <input type="button" name="Button" value="全部选中" onClick="selectall()">
                  </div></td>
                </tr>
			    </form>
              </table>
            </td>
          </tr>
		
        </table>
      </td>
    </tr>
	
  </table>
<h3>
<?
echo "<br/>";
	  echo "会员积分总和".@array_sum($zhifenarr)."<br/>";
	  	  echo "余额总和".@array_sum($moneyarr)."<br/>";
?>
</h3>
  <table width="762" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
      <td align="center"><? $showpage = $page->ShowLink(); 
	  ?>
	  <Br/>
	  <?
	  echo $showpage; echo "共有".$recordcount."个会员";
	  
	  ?></td>
    </tr>
</table>
</body>
</html>